export default {
    type: 'linearProgress',
    data: [
        {
            id: 'id0',
            values: [
                {
                    type: 'Tradition Industries',
                    value: 0.795,
                    goal: 0.7,
                    text: '79.5%'
                }
            ]
        }
    ],
    direction: 'horizontal',
    xField: 'value',
    yField: 'type',
    seriesField: 'type',
    height: 120,
    cornerRadius: 20,
    bandWidth: 30,
    axes: [
        {
            orient: 'right',
            type: 'band',
            domainLine: { visible: false },
            tick: { visible: false },
            label: {
                formatMethod: val => '70%',
                style: {
                    fontSize: 30,
                    fontWeight: 'bold',
                    fill: '#000'
                }
            },
            maxWidth: '80%' // 配置坐标轴的最大空间
        },
        {
            orient: 'bottom',
            label: { visible: true, inside: true },
            type: 'linear',
            visible: false,
            grid: {
                visible: false
            }
        }
    ],

    extensionMark: [
        {
            type: 'text',
            dataId: 'id0',
            visible: true,
            style: {
                x: (datum, ctx, elements, dataView) => {
                    return ctx.valueToX([0]);
                },
                y: (datum, ctx, elements, dataView) => {
                    return ctx.valueToY([datum.type]) - 15;
                },
                fontSize: 14,
                fill: '#000',
                text: '太空站总电量',
                textAlign: 'start',
                textBaseline: 'bottom',
                dy: -12
            }
        },

        {
            type: 'rule',
            dataId: 'id0',
            visible: true,
            style: {
                x: (datum, ctx, elements, dataView) => {
                    return ctx.valueToX([datum.goal])-300;
                },
                y: (datum, ctx, elements, dataView) => {
                    return ctx.valueToY([datum.type]) - 15;
                },
                x1: (datum, ctx, elements, dataView) => {
                    return ctx.valueToX([datum.goal])-300;
                },
                y1: (datum, ctx, elements, dataView) => {
                    return ctx.valueToY([datum.type]) + 15;
                },
                stroke: 'red',
                lineWidth: 2
            }
        }
    ]
};